//
//  XS_BindMobileVC.swift
//  XueDao
//
//  Created by Mac on 2020/12/12.
//

import UIKit

class XS_BindMobileVC: XS_BaseVC {
    
    var model : XS_UserBOM?

    @IBOutlet weak var tableView: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        view.backgroundColor = #colorLiteral(red: 0.968627451, green: 0.968627451, blue: 0.968627451, alpha: 1)
        title = "已绑定手机号"
        tableView.contentInset = UIEdgeInsets.init(top: 0, left: 0, bottom: .bottomHeight, right: 0)
        tableView.register(UINib.init(nibName: "XS_BindMobileCell", bundle: Bundle.main), forCellReuseIdentifier: "XS_BindMobileCell")
        tableView.delegate = self
        tableView.dataSource = self
        
        tableView.backgroundColor = UIColor(red: 0.97, green: 0.97, blue: 0.97, alpha: 1.0)
    }


    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}

extension XS_BindMobileVC : UITableViewDelegate,UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "XS_BindMobileCell", for: indexPath) as! XS_BindMobileCell
        if model != nil {
            cell.mobileLabel.text = model?.phone ?? ""
        }
        cell.delegate = self
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 93
    }
}

extension XS_BindMobileVC : XS_BindMobileCellDelegate{
    func bindMobileCell(_: XS_BindMobileCell, didClickChangeBtn: UIButton) {
        let bindVC = XS_BindNewMobileVC()
        navigationController?.pushViewController(bindVC, animated: true)
    }
    
    
}

